## Problems - [K-Query Online](http://www.spoj.com/problems/KQUERYO/) [^1] ## See also - [Segment tree]() ## External links - [Lecture on Merge Sort Tree and Persistence in Data Structures By Sergey Kulik](https://www.youtube.com/watch?v=6x4-lfhHd_Y) [^1]: Note that the test cases are a little bit shady, sometimes giving queries $i,j$ that don't satisfy $1\leq i\leq j\leq n$. **Blue.Mary** describes the correct behaviour in the comments.